﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using l1cs.server.model.Instance;
using l1cs.server.model;

namespace l1cs.server.clientpackets
{
    public class C_Board : ClientBasePacket
    {
        private const String _C_BOARD = "[C] C_Board";
        private static Logger _log = Logger.getLogger( typeof( C_Board ).FullName );

        private bool isBoardInstance( L1Object obj )
        {
            return ( obj is L1BoardInstance || obj is L1AuctionBoardInstance );
        }

        public C_Board( byte[] abyte0, ClientThread client )
            : base( abyte0 )
        {

            int objectId = readD();
            L1Object obj = L1World.getInstance().findObject( objectId );
            if ( !isBoardInstance( obj ) )
            {
                return; // 不正クライアントでなければあり得ないが・・・
            }
            obj.onAction( client.getActiveChar() );
        }

        override
        public String getType()
        {
            return _C_BOARD;
        }
    }
}